/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.gar.bc;

import edu.upn.sigemfi.gar.be.GarantiaPrendaria;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceUnit;

/**
 *
 * @author Programador
 */
@Stateless
public class GarantiaPrendariaFacade implements GarantiaPrendariaFacadeLocal {
    //@PersistenceUnit(name="edu.upn.sigemfi.gar-ejbPU")
    @PersistenceContext
    private EntityManager em;

    public void create(GarantiaPrendaria garantiaPrendaria) {
        em.persist(garantiaPrendaria);
    }

    public void edit(GarantiaPrendaria garantiaPrendaria) {
        em.merge(garantiaPrendaria);
    }

    public void remove(GarantiaPrendaria garantiaPrendaria) {
        em.remove(em.merge(garantiaPrendaria));
    }

    public GarantiaPrendaria find(Object id) {
        return em.find(GarantiaPrendaria.class, id);
    }

    public List<GarantiaPrendaria> findAll(){
        //return em.createQuery("select object(o) from GarantiaPrendaria as o").getResultList();
        return em.createQuery("GarantiaPrendaria.findAll").getResultList();
    }

}
